﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace XuanXiang.Infrastructure.EFCore.SqlServer
{
    public partial class goodsDBContext : DbContext
    {
        public goodsDBContext()
        {
        }

        public goodsDBContext(DbContextOptions<goodsDBContext> options)
            : base(options)
        {
        }

        public virtual DbSet<SysActionLog> SysActionLogs { get; set; } = null!;
        public virtual DbSet<SysError> SysErrors { get; set; } = null!;
        public virtual DbSet<SysLoginLog> SysLoginLogs { get; set; } = null!;
        public virtual DbSet<SysUser> SysUsers { get; set; } = null!;

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("Server=.;Database=goodsDB;uid=sa;pwd=123456;Encrypt=false;");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<SysActionLog>(entity =>
            {
                entity.HasKey(e => e.AlId)
                    .HasName("PK__Sys_Acti__7FB33DA08FD2C42B");

                entity.ToTable("Sys_Action_log");

                entity.Property(e => e.AlId)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("AL_ID");

                entity.Property(e => e.AlAction)
                    .HasMaxLength(100)
                    .IsUnicode(false)
                    .HasColumnName("AL_Action");

                entity.Property(e => e.AlCreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("AL_CreateTime");

                entity.Property(e => e.AlDesc)
                    .HasMaxLength(255)
                    .IsUnicode(false)
                    .HasColumnName("AL_Desc");

                entity.Property(e => e.AlGroup)
                    .HasMaxLength(100)
                    .IsUnicode(false)
                    .HasColumnName("AL_Group");

                entity.Property(e => e.AlIp)
                    .HasMaxLength(99)
                    .IsUnicode(false)
                    .HasColumnName("AL_IP");

                entity.Property(e => e.AlMethod)
                    .HasMaxLength(20)
                    .IsUnicode(false)
                    .HasColumnName("AL_Method");

                entity.Property(e => e.AlParams)
                    .HasMaxLength(999)
                    .IsUnicode(false)
                    .HasColumnName("AL_Params");

                entity.Property(e => e.AlUId)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("AL_U_ID");

                entity.Property(e => e.AlUrl)
                    .HasMaxLength(999)
                    .IsUnicode(false)
                    .HasColumnName("AL_Url");
            });

            modelBuilder.Entity<SysError>(entity =>
            {
                entity.HasKey(e => e.EId)
                    .HasName("PK__Sys_Erro__D730AF5447D4A60B");

                entity.ToTable("Sys_Error");

                entity.Property(e => e.EId)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("E_ID");

                entity.Property(e => e.ECreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("E_CreateTime");

                entity.Property(e => e.EMessage)
                    .HasMaxLength(999)
                    .IsUnicode(false)
                    .HasColumnName("E_Message");

                entity.Property(e => e.EMethod)
                    .HasMaxLength(20)
                    .IsUnicode(false)
                    .HasColumnName("E_Method");

                entity.Property(e => e.EParams)
                    .HasColumnType("text")
                    .HasColumnName("E_Params");

                entity.Property(e => e.EUrl)
                    .HasMaxLength(99)
                    .IsUnicode(false)
                    .HasColumnName("E_Url");
            });

            modelBuilder.Entity<SysLoginLog>(entity =>
            {
                entity.HasKey(e => e.Llid)
                    .HasName("PK__Sys_Logi__77B11B0686AB88C5");

                entity.ToTable("Sys_Login_Log");

                entity.Property(e => e.Llid)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("LLID");

                entity.Property(e => e.Llcode)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("LLCode");

                entity.Property(e => e.LlcreateTime)
                    .HasColumnType("datetime")
                    .HasColumnName("LLCreateTime");

                entity.Property(e => e.Llresult).HasColumnName("LLResult");

                entity.Property(e => e.Lluid)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("LLUID");
            });

            modelBuilder.Entity<SysUser>(entity =>
            {
                entity.HasKey(e => e.Uid)
                    .HasName("PK__Sys_User__C5B19602791B4BCB");

                entity.ToTable("Sys_Users");

                entity.Property(e => e.Uid)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("UID");

                entity.Property(e => e.Uaccount)
                    .HasMaxLength(11)
                    .IsUnicode(false)
                    .HasColumnName("UAccount");

                entity.Property(e => e.UcreateTime)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("UCreateTime");

                entity.Property(e => e.Ugender)
                    .HasMaxLength(2)
                    .IsUnicode(false)
                    .HasColumnName("UGender");

                entity.Property(e => e.UisActive).HasColumnName("UIsActive");

                entity.Property(e => e.UisBan).HasColumnName("UIsBan");

                entity.Property(e => e.Uname)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("UName");

                entity.Property(e => e.Upassword)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("UPassword");

                entity.Property(e => e.Uphone)
                    .HasMaxLength(11)
                    .IsUnicode(false)
                    .HasColumnName("UPhone");

                entity.Property(e => e.Usalt)
                    .HasMaxLength(32)
                    .IsUnicode(false)
                    .HasColumnName("USalt")
                    .HasComment("盐");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
